07f60d3d7429f023d82bcd29e7eb6e3366ce51d9,community/bolt/src/test/java/org/neo4j/bolt/security/auth/BasicAuthenticationTest.java,BasicAuthenticationTest,shouldThrowAndLogOnFailure,#,67

Before Change


        LogProvider logProvider = mock( LogProvider.class );
        when( logProvider.getLog( BasicAuthentication.class ) ).thenReturn( log );
        BasicAuthentication authentication = new BasicAuthentication( manager, logProvider, identifier );
        when( manager.authenticate( anyString(), anyString() ) ).thenReturn( AuthenticationResult.FAILURE );

        // Expect
        exception.expect( AuthenticationException.class );

After Change


    {
        // Given
        BasicAuthManager manager = mock( BasicAuthManager.class );
        BasicAuthSubject authSubject = mock( BasicAuthSubject.class );
        Log log = mock( Log.class );
        LogProvider logProvider = mock( LogProvider.class );
        when( logProvider.getLog( BasicAuthentication.class ) ).thenReturn( log );
        BasicAuthentication authentication = new BasicAuthentication( manager, logProvider, identifier );
        when( manager.login( anyString(), anyString() ) ).thenReturn( authSubject );
        when( authSubject.getAuthenticationResult() ).thenReturn( AuthenticationResult.FAILURE );

        // Expect
        exception.expect( AuthenticationException.class );